<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Css3 动画</title>
    <style>

        /*定义动画*/
        @keyframes left-right {
            /*开始状态*/
            0% {
                transform: translateX(0px);
            }
            /*结束状态*/
            100% {
                transform: translateX(900px);
            }
        }

        @keyframes move-all {
            /*多个状态的变化*/
            0% {
                transform: translate(0, 0);
            }
            25% {
                transform: translate(900px, 0);
            }
            50% {
                transform: translate(900px, 300px);
            }
            75% {
                transform: translate(0, 300px);
            }
            100% {
                transform: translate(0, 0);
            }
        }

        .animation-1 {
            width: 200px;
            height: 200px;
            background-color: #b7eb8f;
            /*调用自定义动画*/
            animation-name: left-right;
            /*持续时间*/
            animation-duration: 3s;
        }

        .animation-2 {
            width: 150px;
            height: 150px;
            background-color: #589f88;
            /*调用自定义动画*/
            animation-name: move-all;
            /*持续时间*/
            animation-duration: 3s;
            /*动画重复次数 infinite(无限)*/
            animation-iteration-count: 3;
        }

        @keyframes step {
            0% {
                width: 0;
            }
            100% {
                width: 800px;
            }
        }

        .step {
            margin-top: 20px;
            overflow: hidden;
            width: 0;
            height: 30px;
            font-size: 20px;
            /*文字强制一行显示*/
            white-space: nowrap;
            background-color: #c44183;
            animation: step steps(10) 5s forwards;
        }


    </style>
</head>

<body>
<div class="animation-1"></div>

<div class="animation-2"></div>

<div class="step">人的一生,一定要去尝试做一点事情,大小都行,重要的是去体验那种“把事做成”的感受</div>
</body>
</html>